﻿namespace TC
{
    public class Print_blueprint : TranslateBlueprint
    {
        public override editor.cfg.blueprint.Node OnTranslate(Node node)
        {
            Print t = node as Print;
            editor.cfg.blueprint.Print re = new editor.cfg.blueprint.Print();
            re.id = t.id;
            re.info = t.str;

            Port p = null;
            foreach(var i in t.valueIns)
            {
                p = t.graph.GetConnect(i);
                if(p == null)
                {
                    re.parameters.Add(i.name, new editor.cfg.blueprint.ConstString() { value = i.defaultValue.ToString() });
                }
                else
                {
                    re.parameters.Add(i.name, new editor.cfg.blueprint.OutputPin() { nodeId = p.parent.id, pinName = p.name});
                }
            }

            return re;
        }
    }
}
